Skip to content

Conversation

@OleksiienkoMykyta
Copy link
Contributor

Closes #1832
With the previous implementation, setting consistency SERIAL for Paxos reads was impossible. Fixed in this PR

@OleksiienkoMykyta OleksiienkoMykyta force-pushed the issue-1832-add-consistency-serial branch from 76a1c5f to 2d83ec8 Compare October 28, 2024 15:29
Copy link
Contributor

@joao-r-reis joao-r-reis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just remove SerialConsistency altogether and use Consistency everywhere with these changes? I think it would make no difference and we'd get rid of a type that no longer has a reason to exist. Also we're missing a check on the ClusterConfig serial consistency to ensure it's a valid value.

On the other hand we could also keep SerialConsistency around to ensure that only SERIAL or LOCAL_SERIAL can be used when setting the serial consistency level. But to do this we couldn't make it type SerialConsistency = Consistency like it is on this PR. We'd have to keep the previous code for SerialConsistency AND add a Serial+LocalSerial for the Consistency type...

I believe that other drivers don't have a separate consistency level type for SERIAL CONSISTENCY so I'm +1 on the first option (i.e. remove SerialConsistency completely and just use Consistency everywhere with appropriate checks when setting the serial consistency).

@joao-r-reis joao-r-reis changed the title consistency serial was added CASSGO-26 consistency serial was added Nov 5, 2024
@OleksiienkoMykyta
Copy link
Contributor Author

OleksiienkoMykyta commented Nov 8, 2024

@joao-r-reis I had an idea to implement it as you said in the first option, but it's the breaking changes, so I decided to keep backward compatibility. In case this feature is added to v2, there is no reason to leave SerialConsistency.
I added the check to make sure that consistency is valid.

@OleksiienkoMykyta OleksiienkoMykyta force-pushed the issue-1832-add-consistency-serial branch from 2d83ec8 to 3662be4 Compare November 8, 2024 13:51
@joao-r-reis
Copy link
Contributor

@joao-r-reis I had an idea to implement it as you said in the first option, but it's the breaking changes, so I decided to keep backward compatibility. In case this feature is added to v2, there is no reason to leave SerialConsistency. I added the check to make sure that consistency is valid.

Hmm what about if we have type SerialConsistency = Consistency like you did on this PR AND we replace all references of the SerialConsistency type (on parameters etc.) to Consistency? In this scenario I don't think there will be a breaking change. And we can mark SerialConsistency as deprecated

@joao-r-reis
Copy link
Contributor

So basically the only change we would add to this PR is make sure that SerialConsistency is not referenced anywhere (replacing with Consistency) and marking SerialConsistency as deprecated

session.go Outdated
}

if cfg.Consistency.IsSerial() {
return nil, fmt.Errorf("the default consistency level is not allowed to be SERIAL or LOCAL_SERIAL. Recived value: %v", cfg.Consistency)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's fine if Consistency has SERIAL or LOCAL_SERIAL (it won't work with writes but sure, maybe the app only has reads). I meant that cfg.SerialConsistency has to be SERIAL or LOCAL_SERIAL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it slipped my mind that consistency could be SERIAL for read operation, thank you for noticing it.

@OleksiienkoMykyta OleksiienkoMykyta force-pushed the issue-1832-add-consistency-serial branch from 3662be4 to be2bc58 Compare November 12, 2024 15:24
@joao-r-reis
Copy link
Contributor

Looks good, please format your commit message following the rules stated in CONTRIBUTING.md and add this JIRA to the CHANGELOG.md in the Added section of Unreleased, thanks!

We need another committer +1 to merge this.

@OleksiienkoMykyta
Copy link
Contributor Author

@joao-r-reis I had an idea to implement it as you said in the first option, but it's the breaking changes, so I decided to keep backward compatibility. In case this feature is added to v2, there is no reason to leave SerialConsistency. I added the check to make sure that consistency is valid.

Hmm what about if we have type SerialConsistency = Consistency like you did on this PR AND we replace all references of the SerialConsistency type (on parameters etc.) to Consistency? In this scenario I don't think there will be a breaking change. And we can mark SerialConsistency as deprecated

I like this idea, it will solve the issue

@OleksiienkoMykyta OleksiienkoMykyta force-pushed the issue-1832-add-consistency-serial branch 3 times, most recently from accb87e to a18e16e Compare November 13, 2024 09:16
Comment on lines 206 to 208
EachQuorum Consistency = 0x07
LocalOne Consistency = 0x0A
Serial Consistency = 0x08
LocalSerial Consistency = 0x09
Copy link
Contributor

@ribaraka ribaraka Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: move Serial and LocalSerial above LocalOne to maintain sequential order.

session.go Outdated
Comment on lines 147 to 149
if cfg.SerialConsistency > 0 && !cfg.SerialConsistency.IsSerial() {
return nil, fmt.Errorf("the default SerialConsistency level is not allowed to be anything else but SERIAL or LOCAL_SERIAL. Recived value: %v", cfg.SerialConsistency)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding a test for this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And overall, how about adding another test to verify that these two consistency levels are allowed for use?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added some tests to cover each consistency level, please check it

@OleksiienkoMykyta OleksiienkoMykyta force-pushed the issue-1832-add-consistency-serial branch 2 times, most recently from 57f784b to 769a5c1 Compare November 14, 2024 11:05
@OleksiienkoMykyta OleksiienkoMykyta force-pushed the issue-1832-add-consistency-serial branch from 769a5c1 to e963b69 Compare November 14, 2024 12:54
Copy link
Contributor

@jameshartig jameshartig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I like it, let's just make that method be private if we don't need to expose it.

@OleksiienkoMykyta OleksiienkoMykyta force-pushed the issue-1832-add-consistency-serial branch from e963b69 to 0ecbf44 Compare February 3, 2025 09:20
Copy link
Contributor

@jameshartig jameshartig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small thing

@OleksiienkoMykyta OleksiienkoMykyta force-pushed the issue-1832-add-consistency-serial branch 2 times, most recently from f47bf6a to 9a00dde Compare February 26, 2025 13:20
@jameshartig
Copy link
Contributor

@OleksiienkoMykyta There's a merge conflict then this can be merged

The user should be able to set consistency to SERIAL or LOCAL_SERIAL
for Paxos reads, but the previous implementation doesn't support such a feature.

patch by Mykyta Oleksiienko; reviewed by João Reis and James Harting for CASSGO-26
@OleksiienkoMykyta OleksiienkoMykyta force-pushed the issue-1832-add-consistency-serial branch from 9a00dde to 9029339 Compare March 3, 2025 07:38
@OleksiienkoMykyta
Copy link
Contributor Author

@OleksiienkoMykyta There's a merge conflict then this can be merged

fixed

@joao-r-reis joao-r-reis merged commit 0aa180b into apache:trunk Mar 18, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CASSGO-26 Impossible to set CONSISTENCY SERIAL (select consistency)

5 participants